Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use relative path in git mv for cubids apply with --use-datalad #348

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

smeisler
Copy link
Contributor

Closes none, but allows cubids apply to run with datalad.

@@ -410,7 +410,9 @@ def apply_tsv_changes(self, summary_tsv, files_tsv, new_prefix, raise_on_error=T
if Path(from_file).exists():
# if using datalad, we want to git mv instead of mv
if self.use_datalad:
move_ops.append(f"git mv {from_file} {to_file}")
move_ops.append(
f"git mv {os.path.relpath(from_file, str(self.path))} {to_file}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relpath fails if from_file isn't in self.path, right? Is that worth checking explicitly beforehand?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized in retrospect that my git version was kind of old when I first tested, I might revisit this PR again after the hackathon to see if it's necessary.

Copy link
Contributor Author

@smeisler smeisler Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes that would fail, but I'm not sure if that fail mode would actually ever occur.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay cool. I assumed this was a low-hanging fruit that we'd accidentally skipped over, but I'll hold off on reviewing until you've had a chance to circle back to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants